<div class="bg-light lter b-b wrapper-md">
    <h1 class="m-n font-thin h3"><span class="font-bold" translate="aside.nav.query.opecentimeSearch">Service for Operation Time</span>
    </h1>
</div>
<div ng-class="isSmart?'':'wrapper-md'" class="remove-wrapper" ng-controller="OpeCenTimeController" ng-init="init()">
    <div class="panel panel-default">
        <div class="wrapper-sm">
            <div class="col-sm-3" style="width:190px; margin-bottom:5px;">
                <div class="btn-group" style="margin-right:15px;" ng-init="paid = 'false'">
                    <label class="btn btn-sm btn-info font-bold ng-pristine ng-untouched ng-valid active"
                           ng-model="paid" btn-radio="'false'" ng-click="loadOpeCenTimeListData(0)">
                        <i class="fa fa-check text-active"></i> <span translate="business.servreq.stroke0">Unpaid</span></label>
                    <label class="btn btn-sm btn-primary font-bold ng-pristine ng-untouched ng-valid" ng-model="paid"
                           btn-radio="'true'" ng-click="loadOpeCenTimeListData(1)">
                        <i class="fa fa-check text-active"></i> <span
                            translate="business.servreq.stroke1">Paid</span></label>
                </div>
            </div>
            <div class="col-sm-9">
                <div class="input-group">
                    <input ng-model="like" class="form-control"
                           placeholder="{{ (selectLang == 'English') ? 'enter keywords' : '\u8bf7\u8f93\u5165\u5173\u952e\u5b57' }}"
                           type="text" autocomplete="off">
                    <span class="input-group-btn">
					<button class="btn btn-success font-bold" type="button" ng-click="loadOpeCenTimeListData()"><span
                            translate="business.navtitle.search_patient">Search</span></button>
					</span>
                </div>
            </div>
        </div>
        <table class="table table-striped b-t b-light">
            <thead>
            <tr class="panel-heading">
                <th><span class="font-bold" translate="common.number">No.</span></th>
                <th translate="common.updated" ng-if="!isSmart"></th>
                <th><span class="font-bold" translate="business.hosp.OpeCent">OpeCent</span></th>
                <th ng-if="!isSmart"><span class="font-bold" translate="business.accumulation.dateOpe">DateOpe</span>
                </th>
                <th ng-if="!isSmart"><span class="font-bold" translate="business.accumulation.surgeon">Surgeon</span>
                </th>
                <th ng-if="!isSmart"><span class="font-bold" translate="user.countOfPatient">countOfPatient</span></th>
                <th><span class="font-bold" translate="common.operate">Operate</span></th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="model in opeCenTimes">
                <td>{{ (page.currentPage-1)*page.itemsPerPage + $index + 1 }}</td>
                <td ng-if="!isSmart">{{ moment(model.updated).format("YYYY-MM-DD") }}</td>
                <td>{{ (selectLang == "English") ? model._hosp.hosp_En_Name : model._hosp.hosp_Cn_Name }}</td>
                <td ng-if="!isSmart">{{ moment(model.date_Operation).format("YYYY-MM-DD")}}</td>
                <td ng-if="!isSmart">{{ model._surgeon.realName }}</td>
                <td ng-if="!isSmart">{{ model._servReqs.length }}</td>
                <td>
                    <div>
                        <button type="button" class="btn btn-info font-bold"
                                ng-click="getServReqByOCT(model);"
                                ng-if="model._servReqs.length >0"
                        ><span translate="business.servreq.patient"></span></button>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 text-left">
                    <small class="text-muted inline m-t-sm m-b-sm"><span translate="common.showing"></span>
                        {{page.totalItems==0?0:(page.currentPage-1)*page.itemsPerPage+1}}
                        - {{(page.currentPage-1)*page.itemsPerPage+page.currentItems}}
                        <span translate="common.of"></span> {{page.totalItems}} <span translate="common.items"></span>
                    </small>
                </div>
                <div class="col-sm-8 text-right text-center-xs">
                    <pagination ng-model="page.currentPage" ng-change="pageChanged()"
                                total-items="page.totalItems" items-per-page="page.itemsPerPage"
                                max-size="page.maxSize" class="pagination-sm m-t-none m-b"
                                boundary-links="true" rotate="false" previous-text="&lsaquo;"
                                next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></pagination>
                </div>
            </div>
        </footer>
    </div>
</div>

<script type="text/ng-template" id="openServReq.html">
    <div ng-include="'views/work/basic_servreq_flow.html?abc=d'"></div>
</script>

<script type="text/ng-template" id="ServReqsBYOCT.html">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" ng-click="cancel()"><span class="icon icon-close"
                                                                          aria-hidden="true"></span></button>
            <h4 class="modal-title" id="myModalLabel"> {{ 'business.servreq.patient' | translate }}</h4>
        </div>
        <div class="modal-body" ng-controller="OpeCenTimeController">
            <label class="text-danger">
                {{"user.address" | translate }} :
            </label>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th><span translate="common.number"></span></th>
                    <th ng-if="!isSmart"><span translate="common.updated"></span></th>
                    <th><span translate="common.name"></span></th>
                    <th ng-if="!isSmart"><span translate="user.gender"></span></th>
                    <th ng-if="!isSmart"><span translate="business.patcase.disease_type"></span></th>
                    <th translate="business.servreq.paymentAmount" ng-if="!isSmart"></th>
                    <th translate="business.servreq.paid" ng-if="!isSmart"></th>
                    <th><span translate="common.operate"></span></th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="serv in items">
                    <td><span>{{ items.indexOf(serv) + 1 }}</span></td>
                    <td ng-if="!isSmart">{{ moment(serv._patCase._patient.updated).format('YYYY-MM-DD') }}</td>
                    <td>{{ serv._patCase._patient._user.realName }}</td>
                    <td ng-if="!isSmart">
									<span ng-show="serv._patCase._patient._user.gender != null">
					{{ 'user.gender.' + serv._patCase._patient._user.gender  | translate}}
									</span>
                    </td>
                    <td ng-if="!isSmart">{{'business.patcase.disease_type_' + serv._diseaseType.desc | translate}}</td>
                    <td ng-if="!isSmart">{{serv.paid_Amount}}</td>
                    <td ng-if="!isSmart">{{(serv.paid == 0 ? 'business.servreq.paid0' : 'business.servreq.paid1') |
                        translate}}
                    </td>
                    <td>
                        <button type="button" ng-click="open({ templateUrl: 'openServReq.html'}, {{serv}} )"
                                class="btn btn-sm btn-info font-bold" title="{{ 'common.details' | translate }}">
                            {{'common.details' | translate}}
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="modal-footer">
            <button class="btn btn-default" ng-click="cancel()">{{ 'common.close' | translate }}</button>
        </div>
    </div>
</script>


